/**
 * 相邻数字差至少为2，注意lead情况下的搜索
 */
#include <bits/stdc++.h>
using namespace std;

using llt = long long;
llt const MOD = 1E9 + 7;
// Dij, j表示前一位
llt D[15][10]; 
vector<int> G;
int const FULL = 10;
int Target;

llt dfs(int pos, int pre, bool lead, bool limit){
    if(-1 == pos){ 
        return not lead ? 1 : 0;
    }
    if(not lead and not limit and -1 != D[pos][pre]){
        return D[pos][pre];
    }

    int last = limit ? G[pos] : FULL - 1;
    llt ans = 0;
    for(int i=0;i<=last;++i){
        if(0 == i and lead){
            ans += dfs(pos - 1, pre, true, limit&&last==i);
        }else if(lead or i - pre >= 2 or pre - i >= 2){
            ans += dfs(pos - 1, i, false, limit&&last==i);
        }
    }

    if(not lead and not limit){
        D[pos][pre] = ans;
    }
    return ans;
}

llt digitDP(llt n){
    G.clear();
    while(n){
        G.emplace_back(n % FULL);
        n /= FULL;
    }
    auto ans = dfs(G.size() - 1, 0, true, true);
    return ans;
}

llt A, B;
void work(){
    cin >> A >> B;
    auto a = digitDP(A - 1);
    auto b = digitDP(B);
    cout << b - a << endl;
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
    memset(D, -1, sizeof(D));
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
	return 0;
}